.am-container {
  display: contents;
}

.am-button {
  position: relative;
}

.am-button .am-monitor__indicator-mobile {
  display: none;
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  border-radius: 50%;
  width: 0.65rem;
  height: 0.65rem;
  background-color: var(--warning-color);
}
.security-am .am-monitor__indicator-mobile {
  background-color: var(--error-color);
}

.am-button .am-monitor__count {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  height: 18px;
  min-width: 18px;

  color: #fff;
  background-color: var(--warning-color);
  font-weight: 500;
  font-size: var(--font-size-xs);

  border-radius: 16px;
}
.am-button.security-am .am-monitor__count {
  color: #fff;
  background-color: var(--error-color);
}
.am-container div.am-list {
  position: absolute;
  top: 48px;
  right: 2%;
  height: auto;
  padding: var(--section-padding);
  text-align: left;
  display: block;
  background-color: var(--background);
  box-shadow: var(--dropdown-box-shadow);
  border-radius: 15px;
  opacity: 0;
  z-index: 0;
  transform: scale(0);
}

.am-container.am-hidden div.am-list {
  animation: hide-am-list 300ms ease-in 1 normal;
}

.am-container.visible div.am-list {
  opacity: 1;
  animation: show-am-list 300ms ease-in 1 normal forwards;
  z-index: 1000;
}

@keyframes show-am-list {
  from {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.975);
  }
  to {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
  }
}

@keyframes hide-am-list {
  from {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    z-index: 1000;
  }
  to {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.975);
    z-index: 1000;
  }
}

.am-container .am-message {
  display: block;
  line-height: 1.4em;
  margin-bottom: 1.4em;
}
.am-container.visible .am-button:after {
  background: var(--button-background--hover);
}

.am-message-list {
  padding: 0;
  margin: 0;
}

.am-container .am-message .alert form,
.am-container .am-message .jenkins-alert form {
  position: relative;
  float: right;
  margin: -6px 0 0 0 !important;
  gap: 0.5rem;
  display: flex;
  padding-left: 0.5rem;
}

.am-container .am-message .alert form span,
.am-container .am-message .jenkins-alert form span {
  margin: 0 0 0 4px !important;
}

.am-container .am-message .alert,
.am-container .am-message .jenkins-alert {
  margin-bottom: 0 !important;
}

.am-container .am-message dl dt::after {
  content: ": ";
}

/* Restore hyperlink style overriden by the page header */
.am-container .am-list a:link {
  display: inline-block;
  color: var(--link-color);
  text-decoration: underline;
  margin-right: 0;
  padding: 0;
  font-weight: var(--link-font-weight);
}
.am-container .am-list a:visited {
  color: var(--link-color);
}
.am-container .am-list a:hover,
.am-container .am-list a:focus,
.am-container .am-list a:active {
  color: var(--link-color);
  background-color: transparent;
  text-decoration: underline;
  text-decoration: var(--link-text-decoration--hover);
}

.am-container .am-list .jenkins-alert-success a {
  color: var(--alert-success-text-color);
}

.am-container .am-list .jenkins-alert-info a {
  color: var(--alert-info-text-color);
}

.am-container .am-list .jenkins-alert-warning a {
  color: var(--alert-warning-text-color);
}

.am-container .am-list .jenkins-alert-danger a {
  color: var(--alert-danger-text-color);
}

@media screen and (max-width: 576px) {
  /* Hide non-security monitors on mobile view to avoid messing up the heading */
  #visible-am-container {
    display: none;
  }
}

@media screen and (max-width: 768px) {
  .am-button .am-monitor__indicator-mobile {
    display: block;
  }
  .am-button .am-monitor__count {
    display: none;
  }
}
